package com.bawei.yangzongcai___day2.MaiDongFangHong.day4;

import android.annotation.SuppressLint;
import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;

/**
 * create by ertu
 * create on 2021/7/28
 * description
 */
public class CliedTool {

    public  static CliedTool cliedTool;
    public  static  CliedTool getcliedetool(){
        if (cliedTool==null)
        {
            cliedTool = new CliedTool();
        }
        return cliedTool;
    }


    @SuppressLint("CheckResult")
    public static void GlideRadius(Context context, String url, ImageView imageView) {
        //设置图片圆角角度
        RoundedCorners roundedCorners = new RoundedCorners(20);
        RequestOptions options = RequestOptions.bitmapTransform(roundedCorners).override(0, 0);
        Glide.with(context).load(url).apply(options).into(imageView);
    }

    @SuppressLint("CheckResult")
    public static void GlideRadius(Context context, String url, ImageView imageView, int radius) {
        //设置图片圆角角度
        RoundedCorners roundedCorners = new RoundedCorners(radius);
        RequestOptions options = RequestOptions.bitmapTransform(roundedCorners).override(0, 0);
        Glide.with(context).load(url).apply(options).into(imageView);
    }


}

